import {useState, useEffect} from "react";
import axios from "axios";

const useWeather = () => {
    const [WeatherList, setWeatherList] = useState({})
    useEffect(() => {

        async function getWeatherList() {
            const res = await axios.get('https://www.mxnzp.com/api/weather/current/唐山市?app_i' +
                'd=ngeorpqtkeijibqu&app_secret=ZWJlWXFzc21KNjYzVG9iakdBT3cydz09')
            setWeatherList(res.data.data)

        }

        getWeatherList()

    }, [])

    return {WeatherList}
}

export default useWeather